
/*
file:main.cpp
author:Hui Hern
time:Thu 20:47
date:7 Oct 2021
brief:Multiplication of matrices(more to be done)T^T
*/
#include<iostream>
#include"matrix.h"
using namespace std;


int main()
{
    
    int row,column;
    cout<<"Enter the number of rows and columns: ";
    cin>>row>>column;
    Matrix<int> M1(row,column),M2(row,column),M(row,column);
    if(M1.Is_square()==true){      //Identify a square matrix
        cout<<"It is a square matrix"<<endl;
    }
    else cout<<"It is not a square matrix"<<endl;
        cout << "Start input Matrix1:";
    for (int i = 0;i < M1.n_row;i++)
    {
        for (int j = 0;j < M1.n_col;j++)
        {
            cin >> M1.matrix_elements[i][j];
        }
    }
    M1.print_matrix();
    
    cout<<"Enter the number of rows and columns: ";
    cin>>row>>column;
    if(M2.Is_square()==true){
        cout<<"It is a square matrix"<<endl;
    }
    else cout<<"It is not a square matrix"<<endl;
        cout << "Start input Matrix2:";
    for (int i = 0;i < M2.n_row;i++)
    {
        for (int j = 0;j < M2.n_col;j++)
        {
            cin >> M2.matrix_elements[i][j];
        }
    }
    M2.print_matrix();
    
    if(M1.n_col!=M2.n_row){
        cout<<"They cannot proceed multiplication.";
        return 0;
    }
    else{
        M=M1*M2;
        cout<<"The product is "<<endl;
        M.print_matrix();
    }
    
    return 0;
    
}


